             package com.java.diagnostics.visualizer.recommender.oracle;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.DataPoint;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
             import com.java.diagnostics.visualizer.recommender.Recommendation;
             import com.java.diagnostics.visualizer.recommender.RecommendationBase;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             import java.text.MessageFormat;
             
             public class CalculatePauseProperties
               extends RecommendationBase
               implements Recommendation
             {
               protected String label;
               protected int identifier;
               
               public void recommend(AggregateData data)
               {
                 TupleData globalPauseTimeData = data
                   .getTupleData("VGCLabels.pause.times.without.exclusive.access");
                 TupleData scopeRecord = data.getTupleData("VGCLabels.gc.scopes");
                 
                 if (globalPauseTimeData != null) {
                   DataPoint[] intervals = globalPauseTimeData.getDataPoints();
                   DataPoint[] pauses = globalPauseTimeData.getDataPoints();
                   
                   double totalPause = 0.0D;
                   int pauseCount = 0;
                   
                   double totalInterval = 0.0D;
                   if (intervals.length > 0) {
                     double startTime = intervals[0].getRawX();
                     
                     for (int i = 0; i < pauses.length; i++) {
                       if (isCollectionOfGivenScope(scopeRecord, pauses[i], 
                         this.identifier))
                       {
                         totalPause += pauses[i].getRawY();
                         pauseCount++;
                         
                         double time = pauses[i].getRawX();
                         double interval = time - startTime;
                         totalInterval += interval;
                         startTime = time;
                       }
                     }
                     
                     if (pauseCount > 0) {
                       double duration = totalPause / pauseCount;
                       addToSummary(data, makeLabel(this.label, MessageFormat.format(
                         RecommendationLabels.MEAN_PAUSE, 
                         new Object[] { VGCAxes.MILLISECONDS })), 
                         new Double(duration));
                       
                       if (totalInterval > 0.0D) {
                         double interval = totalInterval / pauseCount;
                         addToSummary(
                           data, 
                           makeLabel(this.label, MessageFormat.format(
                           RecommendationLabels.MEAN_INTERVAL, 
                           new Object[] { VGCAxes.MILLISECONDS })), 
                           new Double(interval));
                       }
                     }
                   }
                 }
               }
             }


